﻿Imports Entities
Public Class DetalleFacturaDAL
    Public Shared Function Create(ByVal zObject As DETALLEFACTURA) As DETALLEFACTURA
        Try
            Using bd As New gas_gasdesuvecinoEntities
                bd.DETALLEFACTURA.Add(zObject)
                bd.SaveChanges()
                Return zObject
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
    Public Shared Function ListByFacturaId(ByVal zId As Long) As List(Of DETALLEFACTURA)
        Try
            Using bd As New gas_gasdesuvecinoEntities
                Dim query = (From rec In bd.DETALLEFACTURA
                          Where rec.FACTURA = zId
                          Select rec).ToList
                Return query
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
    Public Shared Function ListByItemId(ByVal zId As Long) As List(Of DETALLEFACTURA)
        Try
            Using bd As New gas_gasdesuvecinoEntities
                Dim query = (From rec In bd.DETALLEFACTURA
                          Where rec.ITEM = zId
                          Select rec).ToList
                Return query
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
End Class
